import request  from '@/utils/request'

export function pageRole(roleDto){
  return request({
    url: '/pd-auth/role/pageRole',
    method:'POST',
    data:roleDto
  })
}

export function delRole(ids){
  return request({
    url:  `/pd-auth/role/DelRoleById/${ids}`,
    method:'get',
  })
}

export function addRole(role){
  return request({
    url: '/pd-auth/role/addRole',
    method:'post',
    data:role
  })
}

export function updRole(role){
  return request({
    url: '/pd-auth/role/UpdateRoleById',
    method:'post',
    data:role
  })
}

//菜单数
export function menuVos(){
  return request({
    url: '/pd-auth/menu/menuVos',
    method:'get',
  })
}

//查询当前角色的菜单
export function listRoleMenu(roleId){
  return request({
    url: `/pd-auth/roleMenu/listRoleMenu/${roleId}`,
    method:'get',
  })
}

//授予菜单
export function addRoleMenu(roleMenuDto){
  return request({
    url: '/pd-auth/roleMenu/addRoleMenu',
    method:'post',
    data:roleMenuDto
  })
}

//根据菜单id查询配置权限
export function listAllByMenuId(menuId){
  return request({
    url: `/pd-auth/resource/listAllByMenuId/${menuId}`,
    method:'get',
  })
}

//更据角色id查询配置权限设置
export function listAllByRoleId(ahthrolidss){
  return request({
    url: `/pd-auth/authRole/listAllByRoleId/${ahthrolidss}`,
    method:'get',
  })
}

//配置权限
export function saveRoleAuthority(authRoleDto){
  return request({
    url: '/pd-auth/authRole/saveRoleAuthority',
    method:'post',
    data:authRoleDto
  })
}

//组织
export function selectOrg() {
  return request({
    url: '/pd-auth/core_org/queryAll',
    method: 'get',
  })
}

//对应的用户
export function lists(userDto) {
  return request({
      url: '/pd-auth/user/lists',
    method: 'post',
    data:userDto
  })
}

//对应的用户
export function userRoleId(userDto) {
  return request({
    url: '/pd-auth/user/userRoleId',
    method: 'post',
    data:userDto
  })
}

//角色添加集合用户
export function addUserRole2(userDto) {
  return request({
    url: '/pd-auth/userRole/addUserRole2',
    method: 'post',
    data:userDto
  })
}
